1. Field
Embodiments of the invention relate to static execution of statements in a program.
2. Description of the Related Art
Relational DataBase Management System (RDBMS) software may use a Structured Query Language (SQL) interface. The SQL interface has evolved into a standard language for RDBMS software and has been adopted as such by both the American National Standards Institute (ANSI) and the International Standards Organization (ISO).
A RDBMS uses relational techniques for storing and retrieving data in a relational database. Relational databases are computerized information storage and retrieval systems. Relational databases are organized into tables that consist of rows and columns of data. The rows may be called tuples or records or rows. A database typically has many tables, and each table typically has multiple records and multiple columns.
JAVA® Database Connectivity (JDBC™) may be described as a JAVA® Application Programming Interface (API) that enables JAVA® programs to dynamically execute SQL statements (JAVA and JDBC are trademarks of Oracle Corporation in the United States, other countries, or both). An IBM® DB2® system may be described as an RDBMS product that provides an ability to statically execute SQL statements (IBM and DB2 are trademarks of International Business Machines Corporation in the United States, other countries, or both).
Static execution of SQL statements provides performance advantages because such statements are prepared before runtime.
Additionally, static execution provides package level access authentication. A package may be described as a server side artifact that stores SQL information for static execution at the server computer. With static execution, users bind SQL statements in a package to statically execute the SQL statements. In a static execution model, a user who has the authority to access the base table will bind the packages and become the package owner. The package owner can then grant the ability to execute the package to a runtime environment authorization ID such as another userid in the data source definition. Because the authorization of the user binding the program is used, the end user does not require direct privileges to execute the statements in the package. In a static execution model, the authorization ID used at runtime is not required to have access to base tables. Instead of access to base tables, as in a dynamic JDBC™ implementation, the runtime authorization ID is given access to a specific predefined package and the inclusive SQL statements. This allows an improved security implementation since authorization IDs cannot change the SQL statements via programming logic. In addition if the authorization ID is used to connect via an alternate access mechanism due to a security breach, the authorization ID cannot execute any dynamic SQL. This also allows a strict auditing of all SQL statements which will be executed against a set of tables.
For example, a program may allow a user to update parts of a table without granting an update privilege on the entire table. This can be achieved by restricting the static SQL statements (i.e., SQL statements that are executed statically) to allow updates to certain columns or to a range of values.
SQLJ is an International Organization for Standardization (ISO) standard for embedding SQL in JAVA® programs. SQLJ may be described as supporting static SQL statements in JAVA® programs. However, users who want to use SQLJ have to learn SQLJ, which is a new, complicated language. If a user wants to run SQL statically, the user has to change existing JDBC™ programs into programs that use SQLJ syntax.
Thus, there is a need in the art for improved static execution of SQL statements in a JDBC™ program.